package com.ruoyi.coal.modules.coalpile.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.coal.modules.coalpile.domain.CpCoalsaveUses;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CpCoalStatisticsDao extends BaseMapper<CpCoalsaveUses> {
    @Select({"select * from cp_coal_save_uses where time = #{time}"})
    CpCoalsaveUses selectByTime(String paramString);

    @Update({"update cp_coal_save_uses set number = #{number},name = #{name},type=#{type} where time = #{time}"})
    int UpdateByTime(CpCoalsaveUses paramCpCoalsaveUses);

    @Select({"select * from cp_coal_save_uses where pile_id = #{pileId}"})
    CpCoalsaveUses selectByPileId(int paramInt);

    @Update({"update cp_coal_save_uses set number = #{number},name = #{name},type=#{type}, time=#{time} where pile_id = #{pileId}"})
    int updateByPileId(CpCoalsaveUses paramCpCoalsaveUses);

    @Select({"SELECT * FROM cp_coal_save_uses  WHERE type IN (1, 2, 3, 0) AND yard_id = #{yardId} GROUP BY YEAR(time), type ORDER BY YEAR(time), type"})
    List<CpCoalsaveUses> getYearlyStatistics(Integer paramInteger);

    @Select({"SELECT * FROM cp_coal_save_uses  WHERE type IN (1, 2, 3, 0) AND yard_id = #{yardId} GROUP BY MONTH(time), type ORDER BY MONTH(time), type"})
    List<CpCoalsaveUses> getMonthlyStatistics(Integer paramInteger);

    @Select({"SELECT * FROM cp_coal_save_uses  WHERE type IN (1, 2, 3, 0) AND yard_id = #{yardId} GROUP BY DAY(time), type ORDER BY DAY(time), type"})
    List<CpCoalsaveUses> getDailyStatistics(Integer paramInteger);
}
